import com.demo.bean.User;
import com.demo.service.IUserService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.List;

/** 使用Spring测试
 * 类描述信息
 * @ClassName App
 * @Description: TODO
 * @author Tomlin
 * @date 2019/1/3 20:23
 * @Viersion V1.0.1
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(value = "classpath:applicationContext.xml")
public class App {
    //注入业务层
    @Autowired
    private IUserService userService;
    @Test
    public void testList(){
        List<User> users = userService.listAll();
        for (User user : users) {
            System.out.println("user = " + user);
        }
    }


    @Test
    public void testList1(){
        List<User> users = userService.listAll();
        for (User user : users) {
            System.out.println("user = " + user);
        }
    }
}

